<?php
/*
	提现
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return['ischecklogin']=cfc('core')->checklogin('','',true);
$credit_types=credit_types(true);
if($_RQ['op']=='get'){
	$member=model('core/member')->basic($_SESSION['uid']);
	$member2=$this->get('member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$member=array_merge($member,$member2);
	$return['member']=$member;
	//商户会员
	$merchids=pdo_getall('jy_merch_user',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('id'),'id');
	if($merchids){
		$merchids=array_keys($merchids);
	}else{
		$merchids=-1;
	}
	$return['fmerchidnum']=pdo_count('jy_merch_member',array('fmerchid'=>$merchids,'merchid'=>$merchids,'uniacid'=>$_SESSION['uniacid']));
	set_html('title','商户带货会员');
	exi($return);
}
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid']);
	//商户会员
	$merchids=pdo_getall('jy_merch_user',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('id'),'id');
	if($merchids){
		$merchids=array_keys($merchids);
	}else{
		$merchids=-1;
	}
	$params['merchid']=$merchids;
	$params['fmerchid']=$merchids;
    $orderby='createtime desc';
	$total='';
	$list=pdo_getslice('jy_merch_member',$params,array($pindex,$psize),$total,'','','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
			$item['merchname']=pdo_getcolumn('jy_merch_user',array('id'=>$item['merchid'],'uniacid'=>$_SESSION['uniacid']),'merchname');
		}
	}
	$return['list']=$list;
	exi($return);
}